package com.lwj.liwanjia.presenter;

import com.lwj.liwanjia.bean.ScAddGwcBean;
import com.lwj.liwanjia.impl.ScAddGwcView;
import com.lwj.liwanjia.model.ScAddGwcModel;

import rx.Subscriber;

/**
 * Created by Administrator on 2017/10/16.
 */

public class ScAddGwcPresenter {
    private ScAddGwcView scAddGwcView;
    private ScAddGwcModel scAddGwcModel;

    public ScAddGwcPresenter(ScAddGwcView scAddGwcView) {
        this.scAddGwcView = scAddGwcView;
        scAddGwcModel = new ScAddGwcModel();
    }

    public void getScData(String token, String commodityCode,double price) {
        if (scAddGwcView != null) {
            scAddGwcModel.getScData(token, commodityCode,price, new Subscriber<ScAddGwcBean>() {
                @Override
                public void onCompleted() {

                }

                @Override
                public void onError(Throwable e) {
                    scAddGwcView.showError((Exception) e);
                }

                @Override
                public void onNext(ScAddGwcBean scAddGwcBean) {
                    scAddGwcView.getScData(scAddGwcBean);
                }
            });
        }
    }
}
